home *** CD-ROM | disk | FTP | other *** search
/ The World's Largest Collection of Windows Software / The World's Largest Collection of Windows Software - Disc 2.iso / textproc / _j2 / collec / keywords.txt < prev    next >
Text File  |  1993-01-28  |  4KB  |  140 lines

  1. '****************************************
  2. 'KeyCollector
  3. '****************************************
  4. Sub MAIN
  5. Dim ErrorLev, ffPath$, ffCSV$, UseRTF
  6. ErrorLev = 0
  7.  
  8. GetProjDir ffPath$, ffCSV$, ErrorLev    'What you'd think
  9. If ErrorLev <> 0 Then Goto Quit
  10.  
  11. JustDir ffPath$        'Separate the path from the file name...
  12. ChDir ffPath$        '...and change to that directory
  13. JustName ffCSV$    'Separate the file name from the path
  14.  
  15. GetKeys ffCSV$
  16. Close #1
  17. Close #2
  18.  
  19. MsgBox "The keywords have been collected in KEYS.CSV."
  20. Quit:
  21. End Sub
  22.  
  23.  
  24. '****************************************
  25. Sub GetProjDir(ffPath$, ffCSV$, ErrorLev)
  26. Dim NumFndFiles, i, n
  27.     FileFind .Location = "All local drives", .Name = "tracker.csv", .Options = 0, .SortBy = 4
  28.     NumFndFiles = CountFoundFiles()
  29.     Dim HPJ$(NumFndFiles)
  30.     For i = 1 To NumFndFiles
  31.         HPJ$(i - 1) = FoundFileName$(i)
  32.     Next
  33.  
  34.     Begin Dialog UserDialog 558, 142, "Choose a project file"
  35.         ListBox 14, 43, 414, 84, HPJ$(), .ListBox1
  36.         OKButton 448, 43, 88, 21
  37.         CancelButton 448, 67, 88, 21
  38.         Text 14, 9, 475, 13, "Choose the Windows Help project from which to collect"
  39.         Text 14, 22, 187, 13, "the footnote information."
  40.     End Dialog
  41.     Dim HPJ As UserDialog
  42.     n = Dialog(HPJ)        'Figure out how to do On Error here
  43.     If n = 0 Then ErrorLev = 1
  44.     ffCSV$ = HPJ$(HPJ.ListBox1)
  45.     ffPath$ = ffCSV$
  46. End Sub
  47.  
  48.  
  49. '****************************************
  50. Sub GetKeys(ffCSV$)
  51. Dim  ffFile$, ffTitle$, KeyTitle$, HelpID$, Browse$
  52. Dim ffKeyWord$, Comments$, BuildTag$, EntryMacro$
  53. Dim n
  54.  
  55. Open ffCSV$ For Input As #1
  56. Open "keys.csv" For Output As #2
  57.  
  58. 'Get the first line out of the way, which just contains titles
  59. Read #1, ffFile$, ffTitle$, KeyTitle$, HelpID$, Browse$, ffKeyWord$, \
  60. Comments$, BuildTag$, EntryMacro$
  61.  
  62. On Error Goto errorhandler
  63. done = 0 : n = 1
  64. While done = 0
  65.     Read #1, ffFile$, ffTitle$, KeyTitle$, HelpID$, Browse$, ffKeyWord$, \
  66.     Comments$, BuildTag$, EntryMacro$
  67.     Goto cont
  68. errorhandler:
  69.     ffKeyword$ = "String too long error"
  70.     err = 0
  71. cont:
  72.     done = Eof(1)
  73.     Print n : n = n + 1
  74.  
  75. '    If you want to write everything to a file, instead of just the keywords, 
  76. '    titles, and filenames, then unREM the next 2 lines, and REM the line below.
  77. '    ParseAndWrite ffFile$, ffTitle$, KeyTitle$, HelpID$, Browse$, ffKeyWord$, \
  78. '    Comments$, BuildTag$, EntryMacro$
  79.     ParseAndWrite ffFile$, ffTitle$, ffKeyWord$
  80. Wend
  81.  
  82. End Sub
  83.  
  84.  
  85. '****************************************
  86. '    If you want to write everything to a file, instead of just the keywords, 
  87. '    titles, and filenames, then unREM the next 2 lines, and REM the line below.
  88. '    Sub ParseAndWrite(ffFile$, ffTitle$, KeyTitle$, HelpID$, Browse$, ffKeyWord$, \
  89. '    Comments$, BuildTag$, EntryMacro$)
  90. Sub ParseAndWrite(ffFile$, ffTitle$, ffKeyWord$)
  91. Dim done, s, temp$, KeyLength, k$
  92.  
  93. done = 0 : s = 0 : temp$ = "" : KeyLength = Len(ffKeyWord$)
  94. While s < KeyLength
  95.     k$ = Mid$(ffKeyWord$, s + 1, 1)
  96.     If k$ = ";" Then
  97. '    If you want to write everything to a file, instead of just the keywords, 
  98. '    titles, and filenames, then unREM the next 2 lines, and REM the line below.
  99. '        Write #2, ffKeyWord$, ffFile$, ffTitle$, KeyTitle$, HelpID$, Browse$, \
  100. '            Comments$, BuildTag$, EntryMacro$
  101.         Write #2, temp$, ffTitle$, ffFile$
  102.         temp$ = ""
  103.         s = s + 1
  104.     Else
  105.         temp$ = temp$ + k$
  106.         s = s + 1
  107.     EndIf
  108. Wend
  109. '    If you want to write everything to a file, instead of just the keywords, 
  110. '    titles, and filenames, then unREM the next 2 lines, and REM the line below.
  111. '    If temp$ <> "" Then Write #2, ffKeyWord$, ffFile$, ffTitle$, KeyTitle$, HelpID$, Browse$, \
  112. '    Comments$, BuildTag$, EntryMacro$
  113. If temp$ <> "" Then Write #2, temp$, ffTitle$, ffFile$
  114.  
  115. End Sub
  116.  
  117.  
  118. '****************************************
  119. Sub JustDir(t$)        'Separate the path from the file name
  120. Dim i
  121.     i = Len(t$)
  122.     While Mid$(t$, i, 1) <> "\"
  123.         i = i - 1
  124.     Wend
  125.     i = i - 1
  126.     t$ = Left$(t$, i)
  127. End Sub
  128.  
  129. '****************************************
  130. Sub JustName(t$)        'Separate the file name from the path
  131. Dim i
  132.     i = Len(t$)
  133.     While Mid$(t$, i, 1) <> "\"
  134.         i = i - 1
  135.     Wend
  136.     i = Len(t$) - i
  137.     t$ = Right$(t$, i)
  138. End Sub
  139.  
  140.